package com.daz.manager.loginHis.action;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.daz.manager.loginHis.pojo.LoginHis;
import com.daz.manager.loginHis.server.impl.LoginHisSV;
import com.github.pagehelper.PageInfo;
import com.opensymphony.xwork2.ActionSupport;

public class LoginHisAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	@Autowired
	private LoginHisSV sv;
	private PageInfo<LoginHis> resultsList;
	private List<LoginHis> list;
	private String id;

    private String role;

    private Date loginDate;

    private String account;

    private String state;

    private String exceptionTxt;
    
    private String msg;
    
    private Boolean success;
    
    private String limit;
    
    private String page;
    
    private Date date1;
    private Date date2;
    
    
    public String qryLoginHis(){
    	HashMap map = new HashMap<String, Object>();
    	if(id != null){
    		map.put("id", id);
    	}
    	if(role != null && !"".equals(role) && !"null".equals(role)){
    		map.put("role", role);
    	}
    	if(account != null && !"".equals(account) && !"null".equals(account)){
    		map.put("account", account);
    	}
    	if(state != null && !"".equals(state) && !"null".equals(state)){
    		map.put("state", state);
    	}
    	if(date1 != null && !"".equals(date1) && !"null".equals(date1)){
    		map.put("date1", date1);
    	}
    	if(date2 != null && !"".equals(date2) && !"null".equals(date2)){
    		map.put("date2", date2);
    	}
    	int p= 0;
    	int s=0;
    	if(page != null){
    		p = Integer.parseInt(page);
    	}
    	if(limit != null){
    		s = Integer.parseInt(limit);
    	}
    	Integer.parseInt(page);
    	try {
    		resultsList = sv.qryByPrimaryKey( map, p, s);
			this.setSuccess(true);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			this.setSuccess(false);
			this.setMsg("系统异常！");
		}
    	return SUCCESS;
    }
    




	public void setLimit(String limit) {
		this.limit = limit;
	}




	public String getPage() {
		return page;
	}




	public void setPage(String page) {
		this.page = page;
	}




	public Date getDate1() {
		return date1;
	}




	public void setDate1(Date date1) {
		this.date1 = date1;
	}




	public Date getDate2() {
		return date2;
	}




	public void setDate2(Date date2) {
		this.date2 = date2;
	}




	public PageInfo<LoginHis> getResultsList() {
		return resultsList;
	}

	public void setResultsList(PageInfo<LoginHis> resultsList) {
		this.resultsList = resultsList;
	}

	public List<LoginHis> getList() {
		return list;
	}

	public void setList(List<LoginHis> list) {
		this.list = list;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public Boolean getSuccess() {
		return success;
	}

	public void setSuccess(Boolean success) {
		this.success = success;
	}

	public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role == null ? null : role.trim();
    }

    public Date getLoginDate() {
        return loginDate;
    }

    public void setLoginDate(Date loginDate) {
        this.loginDate = loginDate;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account == null ? null : account.trim();
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state == null ? null : state.trim();
    }

    public String getExceptionTxt() {
        return exceptionTxt;
    }

    public void setExceptionTxt(String exceptionTxt) {
        this.exceptionTxt = exceptionTxt == null ? null : exceptionTxt.trim();
    }

}
